﻿using Phoenix.Xna.Framework.Serialization;

namespace Phoenix.Xna.Framework.Input.Binding
{
    /// <summary>
    /// Contains information about how specific input hardware keys/buttons, ect. should be bound.
    /// </summary>
    public class InputBinding : IInputBinding
    {
        /// <summary>
        /// Gets or sets the type of device this binding is bound to.
        /// </summary>
        [SerializableProperty(DeviceType.Keyboard)]
        public DeviceType DeviceType { get; set; }

        /// <summary>
        /// Gets or sets the sub type of device such as keys or buttons this binding is bound to.
        /// </summary>
        [SerializableProperty(DeviceSubType.KeyboardKey)]
        public DeviceSubType SubDeviceType { get; set; }

        /// <summary>
        /// Gets or sets the action identifier associated with this binding.
        /// </summary>
        [SerializableProperty("")]
        public string Action { get; set; }

        /// <summary>
        /// Determines if the specified action is the same as the action associated with this binding.
        /// </summary>
        /// <param name="action">The action to compare.</param>
        /// <returns>True if equal, otherwise false.</returns>
        public bool IsAction(string action)
        {
            return (string.Compare(Action, action) == 0) ? true : false;
        }
    }
}
